{template 'common/header-storex'}

{if $op == 'display'}
<div class="wn-main">
	<div class="wn-main__head">操作记录</div>
	<div class="wn-main__content">
		<div class="wn-tabs">
			<div class="wn-tabs__item wn-tabs__item--active">
				<a class="wn-tabs__link" href="{php echo $this->createWebUrl('shop_admin_logs', array('storeid' => $_GPC['storeid'], 'op' => 'display'))}">操作日志管理</a>
			</div>
		</div>
		<div class="clearfix">
			<table class="table table-hover wn-table table-bordered">
				<thead class="navbar-inner">
					<tr><th class='with-checkbox' style='width:30px;'>
						<input type="checkbox" class="check_all" /></th>
						<th style="width:100px;">管理员</th>
						<th style="width:200px;">操作店铺</th>
						<th style="width:200px;">操作时间</th>
						<th style="width:200px;">操作内容</th>
						<th style='width:220px;'>操作URL</th>
						<th style="width:200px;">操作</th>
					</tr>
				</thead>
				<tbody>
				{loop $list $item}
				<tr>
					<td class="with-checkbox">
					<input type="checkbox" name="check" value="{$item['id']}"></td>
					<td>{$item['username']}</td>
					<td>{$item['storeid']}</td>
					<td>{php echo date('Y-m-d H:i:s', $item['time'])}</td>
					<td>{$item['content']}</td>
					<td>{$item['url']}</td>
					<td>
						<a class="btn btn-default" href="#" onclick="drop_confirm('您确定要删除该条操作记录么?', '{php echo $this->createWebUrl('shop_admin_logs',array('op'=>'delete', 'id'=>$item['id'], 'storeid' => $_GPC['storeid']))}');" title="删除" data-toggle="tooltip" data-placement="bottom"><i class="fa fa-times"></i></a>
					</td>
				</tr>
				{/loop}
				<tr>
					<td colspan="8">
						<input type="button" class="btn btn-primary" name="deleteall" value="删除选择的" />
						<div class="pull-right">{$pager}</div>
					</td>
				</tr>
				</tbody>
				<input name="token" type="hidden" value="{$_W['token']}" />
			</table>
		</div>
	</div>
</div>
{/if}
<script type="text/javascript">
	require(['bootstrap'],function($){
		$('.btn').tooltip();
	});
	$(function(){
		$(".check_all").click(function(){
			var checked = $(this).get(0).checked;
			$(':checkbox').each(function(){this.checked = checked});
		});
		$("input[name=deleteall]").click(function(){
			var check = $("input:checked");
			if(check.length<1){
				err('请选择要删除的记录!');
				return false;
			}
			if( confirm("确认要删除选择的记录?")){
				var id = new Array();
				check.each(function(i){
					id[i] = $(this).val();
				});
				$.post("{php echo $this->createWebUrl('shop_admin_logs',array('op'=>'deleteall', 'storeid' => $_GPC['storeid']))}", {idArr:id},function(data){
					if (data.message.errno ==0) {
						util.message(data.message.message, 'refresh', 'success');
					} else {
						util.message(data.message.message);
					}
				},'json');
			}
		});
	});
	
	function drop_confirm(msg, url){
		if(confirm(msg)){
			window.location = url;
		}
	}
</script>
{template 'common/footer-storex'}